/*
*  Copyright 2019-2023 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.system.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @description /
* @author shitou
* @date 2024-04-21
**/
@Data
@TableName("teachchapter")
public class TeachchapterDo implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value = "id")
    private Long id;

    @ApiModelProperty(value = "数字教材id")
    private Integer teachid;

    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "状态")
    private Integer state;

    @ApiModelProperty(value = "排序")
    private Integer orderby;

    @ApiModelProperty(value = "创建用户")
    private Long userid;

    @ApiModelProperty(value = "创建时间")
    private String createtime;

    @ApiModelProperty(value = "操作时间")
    private Long lastupdatetime;

    private String content;

//    private List<TeachsubsectionDo> children;

    private List<Map<String,Object>> children;

    public void copy(TeachchapterDo source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
    public static TeachchapterDo convertFromTypeA(Teachchapter typeA) {
        TeachchapterDo typeB = new TeachchapterDo();
        typeB.setId(typeA.getId()); // 假设字段名和类型相同
        typeB.setName(typeA.getName()); // 假设字段名和类型相同
        typeB.setCreatetime(typeA.getCreatetime()); // 假设字段名和类型相同
        typeB.setOrderby(typeA.getOrderby());
        typeB.setState(typeA.getState());
        typeB.setTeachid(typeA.getTeachid());
        typeB.setLastupdatetime(typeA.getLastupdatetime());
        typeB.setUserid(typeA.getUserid());
        return typeB;
    }

}
